<template>
  <div id="app">
    <router-view/>
		<router-link to="/home" tag="button" replace >首页</router-link>
		<router-link to="/about"  tag="button" replace>关于</router-link>
		<button type="button" @click="homeClick()">按钮1</button>
    <router-link v-bind:to="'./user/'+names" tag="button">用户</router-link>
    <router-link  tag="button" v-bind:to="{path:'/profile',query:{name:'xieyingpeng',age:21}}">档案</router-link>
    <button @click="profileClick()">通过按钮完成上面的方法</button>
	
  </div>
</template>

<script>
export default {
  name: 'App',
  data(){
    return{
      names:'lisi'
    }
  },
  methods:{
	  homeClick(){
		  this.$router.push('/home');//通过代码的方式修改路由 vue-router
	  },
    profileClick(){
      this.$router.push({//传入一个对象
        path:'/profile',
        query:{
          name:'xx',
          age:12
        }
      })
    }
  }
}
</script>

<style>

</style>
